uniform mat4 u_mvpMatrix;
uniform mat4 ma_View;
attribute vec3 a_posL;
attribute vec2 a_uv;
uniform vec3 campos;
uniform sampler2D Heigh_Map;

varying vec2 v_uv;
varying float e_fog;
void main()
{
	float fogStart=1.0;
	vec4 c_height= texture2D(Heigh_Map, a_uv);
	vec4 posL=vec4(a_posL, 1.0);
	posL.y=(c_height.r*3.0+c_height.g*2.0+c_height.b)*1.0;
	vec4 posOfP=ma_View*posL;
	gl_Position = u_mvpMatrix*posL;
	//float DistoCam=distance(posL.xyz,campos.xyz);
	float DistoCam=length(posOfP.xyz-campos.xyz);
	e_fog=clamp((DistoCam-fogStart)/4.5,0.0,1.0);
	v_uv = a_uv;
}
   